<?php
/**
 * Galdic project
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Galdic
 * @package    Admin_Controller
 * @copyright  Copyright (c) 2009 vifito (http://vifito.eu)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Admin_PanelController
 * 
 * @package    Admin_Controller
 * @copyright  Copyright (c) 2009 vifito (http://vifito.eu)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: PanelController.php 1 2009-09-12 11:53:51Z vifito $
 */
class Admin_PanelController extends Zend_Controller_Action
{
    /**
     * Check session
     */
    public function preDispatch()
    {
        $session = Zend_Registry::get('session');
        $actionName = $this->getRequest()->getActionName();
        
        if(!isset($session->username) && ($actionName!='login')) {
            $this->_redirect('/admin/user/login/');
        } elseif( isset($session->username) ) {
            $this->view->username = $session->username;
        }
    }

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $this->view->title = "Panel de Control";
        $this->view->headTitle($this->view->title, 'PREPEND');
    }


}



